﻿@model IEnumerable<Blogger.UI.Models.Posting>
@{
    ViewBag.Title = "Posting";
    Layout = "~/Views/Shared/_UILayout.cshtml";
    Blogger.UI.Models.Blog blog = ViewBag.Blog;
}
<h2>
    The Posting you have for this Blog: @blog.Name</h2>
<p>
    A blog may contain as many as Posts , so go ahead and @Html.ActionLink("Create New", "CreatePosting", "BlogUI", new { id = 0, blogId = blog.ID }, null)
    Posts on this blog.
</p>
<table>
    <tr>
        <th class="mota">
            BlogName
        </th>
        <th class="mota">
            @Html.DisplayNameFor(model => model.Name)
        </th>
        <th class="mota">
            @Html.DisplayNameFor(model => model.Title)
        </th>
        <th class="mota">
            @Html.DisplayNameFor(model => model.Category)
        </th>
        <th class="mota">
            Post Status
        </th>
        <th class="mota">
            Next Action
        </th>
        <th class="mota">
            Manage Posts
        </th>
    </tr>
    @if (!Model.Any())
    {
        <tr>
            <td class="mota" colspan="7">
                You have yet to have any Post so far on @blog.Name .
                 @Html.ActionLink("Create New", "CreatePosting", "BlogUI", new { id = 0, blogId = blog.ID }, null)
                Post here.
            </td>
        </tr>
    }
    @foreach (var item in Model)
    {
        <tr>
            <td class="mota">
                @blog.Name
            </td>
            <td class="mota">
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td class="mota">
                @Html.DisplayFor(modelItem => item.Title)
            </td>
            <td class="mota">
                @Html.DisplayFor(modelItem => item.Category)
            </td>
            <td class="mota">
                 @Html.DisplayFor(modelItem => item.Status)
            </td>
            <td class="mota">
                @Html.ActionLink("Preview", "PreviewPosting", new { id = item.ID }) |
                @Html.ActionLink("Publish", "PublishPosting", new { id = item.ID })
            </td>
            <td class="mota">
                @Html.ActionLink("Edit", "EditPosting", new { id = item.ID }) |
                @Html.ActionLink("Delete", "DeletePosting", new { id = item.ID })
            </td>
        </tr>
    }
</table>
<br />
You can always go back to @Html.ActionLink("Blog List", "Index") created by you.
